<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace app\assets;

use yii\web\AssetBundle;
use \yii\web\View;

/**
 * Main application asset bundle.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class AppAsset extends AssetBundle
{

    public $basePath = '@webroot';
    public $baseUrl = '@web';

    public $css = [
        ['css/element-ui-2.13.0.css', 'position' => View::POS_END],
//        ['css/animate.min.css', 'position' => View::POS_END],
        ['css/vue2-animate.min.css', 'position' => View::POS_END],
        ['css/main.css', 'position' => View::POS_END],
        ['css/icon.css', 'position' => View::POS_END]
    ];

    public $js = [
        ['js/jquery.min.js', 'position' => View::POS_HEAD],
        ['js/vue.js', 'position' => View::POS_HEAD],
        ['js/element-ui-2.13.0.js', 'position' => View::POS_HEAD],
        'js/common.js',
    ];

    public $depends = [
    ];

    //定义按需加载JS方法  ，注意加载顺序在最后
    public static function addScript($view, $jsfile)
    {
        $view->registerJsFile($jsfile, [
            AppAsset::className(),
            'depends' => 'app\assets\AppAsset'
        ]);
    }

    //定义按需加载css方法，注意加载顺序在最后
    public static function addCss($view, $cssfile)
    {
        $view->registerCssFile($cssfile, [
            AppAsset::className(),
            'depends' => 'app\assets\AppAsset'
        ]);
    }
}
